Skip to content

feat(runner): live shape checks for the two AI endpoints (DEV-2203) - #187

Merged
danielzytohoc merged 11 commits into
masterfrom
feat/DEV-2203-ai-live-spec
Aug 19, 2026
Merged

feat(runner): live shape checks for the two AI endpoints (DEV-2203)#187
danielzytohoc merged 11 commits into
masterfrom
feat/DEV-2203-ai-live-spec

Conversation

@danielzytohoc

@danielzytohoc danielzytohoc commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Seventh in the DEV-2203 series. Stacked on #186.

What

e2e/ai-live.spec.ts — two API-level tests, double-gated (E2E_BASE_URL + E2E_AI=1), that prove the deployed gateway chain returns something usable (never an opinion on content quality):

  • POST /api/chat → 200 with the documented shape: non-empty message, edits/references/pages arrays.
  • POST /api/theme ("corporate green") → 200 with a whitelist-clean suggestion — every token key must be in the product's own generated TOKEN_KEYS, palette keys must match the ramp grammar — and the suggestion must move at least one thing (an empty 200 is the DEV-2497 class of quiet failure).

429 → test.skip: both endpoints share the 8/min-per-IP bucket with real users.

Verification

Both passed against production (7.6 s / 7.9 s, ~2 LLM calls). Skip behavior verified without the gates. First live run caught a subtlety now documented in the spec: the chat validator silently drops non-relative file paths and then refuses the all-dropped map as "files are required".


Note

Low Risk
Test-only addition with double env gating; no production or auth logic changes, only optional live checks against deployed APIs.

Overview
Adds runner/e2e/ai-live.spec.ts, a Playwright suite that hits the deployed POST /api/chat and POST /api/theme gateways and asserts response shape, not answer quality. Tests run only when E2E_BASE_URL is set and E2E_AI=1 (explicit opt-in to real LLM spend and the shared 8/min-per-IP rate limit).

/api/chat expects 200 with a non-empty message string and edits, references, and pages arrays; the fixture uses relative file paths so the validator does not drop the whole files map.

/api/theme ("corporate green") expects 200, token keys in the generated TOKEN_KEYS whitelist, palette keys matching the ramp grammar, and at least one change across tokens, palette, or config (guards empty 200s).

skipIfRefused skips on 429 and budget_* 401/503 refusals; other failures (e.g. missing gateway key) still fail the run.

Reviewed by Cursor Bugbot for commit dcdb5b7. Bugbot is set up for automated code reviews on this repo. Configure here.

panels.spec.ts and style-apply's recorded payloads prove the drawers;
nothing proved the deployed chain — worker → LiteLLM → model →
whitelist — returns something usable at all. Two API-level calls, one
file, double-gated (E2E_BASE_URL + E2E_AI=1): /api/chat answers with
the documented shape, /api/theme answers with a whitelist-clean,
non-empty suggestion (an empty 200 is the DEV-2497 class of quiet
failure). The theme whitelist assertion imports the product's own
generated TOKEN_KEYS, so a sanitiser regression fails here too.

A 429 skips rather than fails: both endpoints share the 8/min-per-IP
bucket with real users, and traffic is not a product failure.

The chat body uses relative file paths on purpose — the validator
silently drops unsafe paths and an all-dropped map fails as 'files are
required' (this spec's first live run found that the hard way).

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 90e69fd. Configure here.

Comment thread runner/e2e/ai-live.spec.ts Outdated
Dan Zyto added 3 commits August 17, 2026 08:35
…gbot #187)

Both endpoints sit behind the budget gate as well as the per-IP bucket:
an anonymous caller gets 401 budget_login_required at anon_blocked and
503 budget_exhausted at new_blocked/closed. Those are spend policy, not
the AI chain — the same class as a 429 — so they skip. A 503
chat_unavailable stays a failure: a missing gateway key IS the product
being broken.
@danielzytohoc
danielzytohoc requested a review from demtario August 18, 2026 15:46
Base automatically changed from feat/DEV-2203-share-create-live to master August 19, 2026 10:42
@danielzytohoc
danielzytohoc merged commit 121015c into master Aug 19, 2026
7 checks passed
@danielzytohoc
danielzytohoc deleted the feat/DEV-2203-ai-live-spec branch August 19, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants